]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
inhibitShortcutsDialog: Don't override resource
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 6 Oct 2022 12:30:20 +0000 (14:30 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 6 Oct 2022 12:47:43 +0000 (14:47 +0200)
PermissionStore's Set() method takes a complete permission
table, so when setting an app's permission, we are implicitly
removing all previously set entries for other apps.

Switch to the SetPermission() method which sets the permission
for a single app.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5937

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2504>

data/dbus-interfaces/org.freedesktop.impl.portal.PermissionStore.xml
js/ui/inhibitShortcutsDialog.js

index 75fbc468a8640550b2575f57cfe927b004363381..55d3fc30cb586f515a2b2e0ffdfda50f67c0b8b3 100644 (file)
       <arg name="app_permissions" type="a{sas}" direction="in"/>
       <arg name="data" type="v" direction="in"/>
     </method>
+    <method name="SetPermission">
+      <arg name='table' type='s' direction='in'/>
+      <arg name='create' type='b' direction='in'/>
+      <arg name='id' type='s' direction='in'/>
+      <arg name='app' type='s' direction='in'/>
+      <arg name='permissions' type='as' direction='in'/>
+    </method>
     <signal name="Changed">
       <arg name="table" type="s" direction="out"/>
       <arg name="id" type="s" direction="out"/>
index f37c1f60549404da58cca37e20ed5b5a834482ac..b6f1330b2cfb8a9897844b0443d1db94154a5442 100644 (file)
@@ -1,5 +1,5 @@
 /* exported InhibitShortcutsDialog */
-const { Clutter, Gio, GLib, GObject, Gtk, Meta, Pango, Shell, St } = imports.gi;
+const {Clutter, Gio, GObject, Gtk, Meta, Pango, Shell, St} = imports.gi;
 
 const Dialog = imports.ui.dialog;
 const ModalDialog = imports.ui.modalDialog;
@@ -57,16 +57,12 @@ var InhibitShortcutsDialog = GObject.registerClass({
         if (!this._shouldUsePermStore() || this._permStore == null)
             return;
 
-        let permissions = {};
-        permissions[this._app.get_id()] = [grant];
-        let data = GLib.Variant.new('av', {});
-
         try {
-            await this._permStore.SetAsync(APP_PERMISSIONS_TABLE,
+            await this._permStore.SetPermissionAsync(APP_PERMISSIONS_TABLE,
                 true,
                 APP_PERMISSIONS_ID,
-                permissions,
-                data);
+                this._app.get_id(),
+                [grant]);
         } catch (error) {
             log(error.message);
         }